import request from '@/utils/request'

// 查询用户绑定列表
export function listUserBinding(query) {
  return request({
    url: '/wx/binding/list',
    method: 'get',
    params: query
  })
}

// 查询用户绑定详细
export function getUserBinding(id) {
  return request({
    url: '/wx/binding/' + id,
    method: 'get'
  })
}

// 新增用户绑定
export function addUserBinding(data) {
  return request({
    url: '/wx/binding',
    method: 'post',
    data: data
  })
}

// 修改用户绑定
export function updateUserBinding(data) {
  return request({
    url: '/wx/binding',
    method: 'put',
    data: data
  })
}

// 删除用户绑定
export function delUserBinding(id) {
  return request({
    url: '/wx/binding/' + id,
    method: 'delete'
  })
}

// 根据微信openid查询系统用户
export function getSysUserByWxOpenid(openid) {
  return request({
    url: '/wx/binding/sysuser/openid/' + openid,
    method: 'get'
  })
}

// 根据系统用户ID查询微信用户
export function getWxUserBySysUserId(userId) {
  return request({
    url: '/wx/binding/wxuser/sysuser/' + userId,
    method: 'get'
  })
}

// 根据手机号查询系统用户
export function getSysUserByPhone(phone) {
  return request({
    url: '/wx/binding/sysuser/phone/' + phone,
    method: 'get'
  })
}

// 解绑用户
export function unbindUser(userId) {
  return request({
    url: '/wx/binding/unbind/' + userId,
    method: 'post'
  })
} 